package com.smartticket.jeju.controller.user;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.SessionAttributes;

import com.smartticket.jeju.service.UserService;

@Controller
@RequestMapping("/login")
@SessionAttributes("userId")
public class Login 
{
	@Autowired
	private UserService userService;
	
	@RequestMapping
	public String action(@RequestParam String id, @RequestParam String pw, Model model)
	{
		if(userService.checkUser(id, pw))
		{
			model.addAttribute("userId", id);
		}
		
		return "redirect:/main";
	}
}
